package com.forum.pojo;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
/**
 * @ClassName OSSConstantProperties
 * @Description TODO
 * @Author suyao
 * @Version 1.0
 */

@Component
@ConfigurationProperties(prefix = "aliyun.oss")
public class ConstantPropertiesUtils implements InitializingBean {

    //读取配置文件的内容
    @Value("${aliyun.oss.endPoint}")
    private String endpoint;
    @Value("${aliyun.oss.accessKeyId}")
    private String keyId;
    @Value("${aliyun.oss.accessKeySecret}")
    private String keySecret;
    @Value("${aliyun.oss.bucketName}")
    private String bucketName;

    //定义公共静态常量
    public static String END_POINT;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint;
        ACCESS_KEY_ID = keyId;
        ACCESS_KEY_SECRET = keySecret;
        BUCKET_NAME = bucketName;
    }
}



